<?php 
$db = include('../Application/Common/Conf/config.php'); 
	if($_POST){		
		$id = $_POST['id'];
		$v_oid = $_POST['v_oid'];
		$v_amount = $_POST['v_amount'];
		$jinbi = $_POST['jinbi'];
		$host =  $db['DB_HOST'];
		$port =  $db['DB_PORT'];
		$dbname =  $db['DB_NAME'];
		$user =  $db['DB_USER'];
		$psw =  $db['DB_PWD'];
		$dbconn = pg_connect("host=$host port=$port dbname=$dbname user=$user password=$psw");			
		if($dbconn){				
			$sql = "INSERT INTO tbusercashflow (nuserid,ntype,nstate,corderid,coutorderid,fcash,nmoney,cpaytype) VALUES ('$id',1,0,'$v_oid','$v_oid',$v_amount,'$jinbi','网银在线') RETURNING  nid;";				
			$result = pg_query($dbconn,$sql);
			$data = pg_fetch_assoc($result);
			if($data['nid']){
				
				echo $data['nid'];
			}else{
				echo 0;
			}
			
				
		}		
	}
					
?>